﻿namespace HiMap.Carto
{
    using HiMap.Base;
    using HiMap.Style;
    using System;
    using System.Drawing;

    public class PolygonStyleClass : HiMapPtrClass, IPolygonStyle, IStyle, IHiMapPtr
    {
        public PolygonStyleClass(int InPtr, bool Used)
        {
            base.m_InPtr = InPtr;
            base.m_Used = Used;
        }

        Color IPolygonStyle.FillColor
        {
            get
            {
                int num = HiMap.Carto.VC.KWG_POLYGONSTYLE_GET_FILLCOLOR(base.m_InPtr);
                int red = num % 0x100;
                int green = (num % 0x10000) / 0x100;
                int blue = num / 0x10000;
                return Color.FromArgb(red, green, blue);
            }
            set
            {
                int fillcolor = (value.R + (value.G * 0x100)) + ((value.B * 0x100) * 0x100);
                HiMap.Carto.VC.KWG_POLYGONSTYLE_SET_FILLCOLOR(base.m_InPtr, fillcolor);
            }
        }

        Color IPolygonStyle.OutLineColor
        {
            get
            {
                int num = HiMap.Carto.VC.KWG_POLYGONSTYLE_GET_LINECOLOR(base.m_InPtr);
                int red = num % 0x100;
                int green = (num % 0x10000) / 0x100;
                int blue = num / 0x10000;
                return Color.FromArgb(red, green, blue);
            }
            set
            {
                int linecolor = (value.R + (value.G * 0x100)) + ((value.B * 0x100) * 0x100);
                HiMap.Carto.VC.KWG_POLYGONSTYLE_SET_LINECOLOR(base.m_InPtr, linecolor);
            }
        }

        int IPolygonStyle.OutLineWidth
        {
            get
            {
                return HiMap.Carto.VC.KWG_POLYGONSTYLE_GET_LINEWIDTH(base.m_InPtr);
            }
            set
            {
                HiMap.Carto.VC.KWG_POLYGONSTYLE_SET_LINEWIDTH(base.m_InPtr, value);
            }
        }

        StyleType IStyle.Type
        {
            get
            {
                return StyleType.PolygonStyle;
            }
        }
    }
}

